package gcode.helloworld.java.cmd;

public class ShutdownHook {
	public static void main(String args[]){
		System.out.println("start");
		ShutdownHook cmd=new ShutdownHook();
		cmd.installShutdownHook();
		try{
			Thread.sleep(1000*10*10);
		}catch(InterruptedException e){
			e.printStackTrace();
		}
	}
	private void shutdown(){
		System.out.println("shutdown");
	}
	private void installShutdownHook(){
		Runtime.getRuntime().addShutdownHook(new Thread(){
			public void run(){
				shutdown();
			}
		});
	}
}
